package sanshi.contect.builder;

public class Person {
    private int age;
    private String name;
    private Location location;
    private int weight;

    private Person(){}

    //构建基础信息的Person
    public static class PersonBuilder{
        Person p = new Person();

        public PersonBuilder builerBasic(int age, String name){
            p.age = age;
            p.name = name;
            return this;
        }
        public PersonBuilder builerWeight(int weight){
            p.weight = weight;
            return this;
        }
        public PersonBuilder buileLocationr(Location location){
            p.location = location;
            return this;
        }
        public Person bulid(){
            return p;
        }
    }

    @Override
    public String toString() {
        return "Person{" +
                "age=" + age +
                ", name='" + name + '\'' +
                ", location=" + location +
                ", weight=" + weight +
                '}';
    }
}
class Location{
    private String Loc;

    public Location(String loc) {
        Loc = loc;
    }

    @Override
    public String toString() {
        return "Location{" +
                "Loc='" + Loc + '\'' +
                '}';
    }
}
